package com.base.component.ai.agent.bo;

import java.io.Serializable;
import java.util.function.Consumer;

import org.slf4j.MDC;

import com.base.core.head.constants.MdcConstants;
import com.gitee.magic.core.annotations.Transient;
import com.gitee.magic.core.json.JsonObject;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 整个Flow过程的共享数据
 * @author zywei
 *
 */
@Getter@Setter@ToString
public class ContextBO<M,CP extends ContextParamBO,PP>  implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public ContextBO() {
		this(null,MDC.get(MdcConstants.REQUESTID),"default");
	}
	
	public ContextBO(String clientId,String requestId,String bizType) {
		this.clientId=clientId;
		this.requestId=requestId;
		this.bizType=bizType;
		this.payload=new JsonObject();
	}

    @Schema(description = "业务场景")
	private String bizType;

    @Schema(description = "客户端请求Id")
    private String clientId;
    
    @Schema(description = "请求Id")
	private String requestId;
    
    @Schema(description = "消息")
    private M msg;
    
    @Schema(description = "透传参数")
    private JsonObject payload;

    @Schema(description = "容器参数")
    private CP contextParam;

    @Schema(description = "Prompt参数")
    private PP promptParam;
    
    @Schema(description = "终止")
    private boolean terminate;

    @Transient
    @Schema(description = "帧输出")
    private Consumer<Object> frameConsumer;
    
}
